#include <iostream>
#include <string>
using namespace std;

string weigh[3];
int num;  //假币的编号[1-11]
int state; //假币的重量,轻为0,重为1
char coin[12]={'A','B','C','D','E','F','G','H','I','J','K','L'};

bool search(int,int);
int main() {
	int cases;
	cin >> cases;
	cin.ignore(1);//忽略回车,否则会被第一个getline读入
	for(int i=0;i<cases;++i) {

		for(int j=0;j<3;++j) {
			getline(cin,weigh[j]);
		}
	
		bool go_on=true;
		for(int _num=0;_num<12;++_num) {  //进行24种可能的搜索
			for(int _state=0;_state<2;++_state) {
				if(search(_num,_state)) {   //成功匹配
					num=_num;
					state=_state;
					go_on=false;
				}
			}
			if(!go_on) break;
		}

		cout << coin[num] << " is the counterfeit coin and it is ";
		cout << ((state==0) ? "light": "heavy") << endl;
	}
	return 0;
}

bool search(int num,int state) {
	char feit_num=num+'A';
	int feit_state=state;
	for(int i=0;i<3;++i) {
		if(weigh[i].find("even")!=string::npos) { //even的情况

				if(weigh[i].find(feit_num)!=string::npos) {
					return false;
				}
				
		} else if(weigh[i].find("up")!=string::npos) {//up的情况

			if(feit_state==0) {//若假硬币轻,则此时出现在天平右边
				if(weigh[i].find(feit_num)<weigh[i].find(' ')||weigh[i].find(feit_num)==string::npos) {
					return false;
				}
			} else {//若假硬币重,则此时出现在天平的左边
				if(weigh[i].find(feit_num)>weigh[i].find(' ')||weigh[i].find(feit_num)==string::npos) {
					return false;
				}
			}

		} else { //down的情况

			if(feit_state==0) { //若假硬币轻,则此时出现在天平的左边
				if(weigh[i].find(feit_num)>weigh[i].find(' ')||weigh[i].find(feit_num)==string::npos) {
					return false;
				}
			} else { //若假硬币轻,则此时出现在天平的右边
				if(weigh[i].find(feit_num)<weigh[i].find(' ')||weigh[i].find(feit_num)==string::npos) {
					return false;
				}
			}
		}
	}
	return true;
}
